<template>
  <div class="goods">
    <page-content :contentTableConfig="contentTableConfig" pageName="goods">
      <template #oldPrice="value">
        <span>￥{{ value.row.oldPrice }}</span>
      </template>
      <template #status="scope">
        <el-button :type="scope.row.status ? 'success' : 'danger'" plain>
          <!-- scope.row 就是拿到插槽里面 ：row 对应的值 -->
          {{ scope.row.status ? "售卖中" : "已下架" }}
        </el-button>
      </template>
      <template #imgUrl="value">
        <el-image
          style="width: 60px; height: 60px"
          :src="value.row.imgUrl"
          :preview-src-list="[value.row.imgUrl]"
          fit="cover"
          preview-teleported
        />
      </template>
    </page-content>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import PageContent from "@/components/page-content/src/page-content.vue";
import { contentTableConfig } from "./config/content.config";

export default defineComponent({
  name: "goods",
  setup() {
    return {
      contentTableConfig,
    };
  },
  components: { PageContent },
});
</script>

<style scoped lang="less">
.el-image {
  z-index: 1000;
}
</style>
